package demo.glob;

import java.io.File;
import java.io.IOException;
import java.util.List;

import com.esotericsoftware.wildcard.Paths;
import com.google.common.base.Charsets;
import com.google.common.io.Files;

public class GlobDemo {
    public static void main(String[] args) throws IOException {
        Paths paths = new Paths();
        paths.glob("D:\\MyEclipseWorkspace", "**/*.xml", "!**/.svn/**", "!**/classes/**",
                "!*/target/**", "!**/pom.xml", "!*/.settings/**");

        List<File> files = paths.getFiles();
        for (File file : files) {
            String text = Files.toString(file, Charsets.UTF_8);
            if (text.indexOf("<sqlMap") < 0 || text.indexOf("<select") < 0) {
                continue;
            }
            System.out.println(file);
        }
    }
}
